﻿<%@ Page Title="Planning" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="UserStories.aspx.cs" Inherits="APMAWebConsole.PlanningPart.UserStories" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        User Stories
    </h2>

    <asp:Button ID="btnAddUserStory" runat="server" Text="Add User Story" OnCommand="OnButtonCommand" CommandName="Add"/>
    <asp:Button ID="btnRemoveUserStory" runat="server" Text="Remove User Story" OnCommand="OnButtonCommand" CommandName="Remove" Visible="false"/>
    <asp:Button ID="btnEditUserStory" runat="server" Text="Edit User Story" OnCommand="OnButtonCommand" CommandName="Edit" Visible="false"/>
    <asp:Button ID="btnViewUserStory" runat="server" Text="View User Story" OnCommand="OnButtonCommand" CommandName="View" Visible="false"/>
    <asp:Button ID="btnBackToList" runat="server" Text="Back to User Story List" OnCommand="OnButtonCommand" CommandName="BackToList" CausesValidation="False"/>
        
    <div id="divUserStoriesGrid" runat="server">
        <p>
            <asp:Label ID="lblSelectedUserStory" runat="server" AssociatedControlID="txtSelectedUserStory" Text="Selected User Story ID:" Visible="false" />
            <asp:TextBox ID="txtSelectedUserStory" runat="server" CssClass="textEntry" Text="0" Visible="false" />
        </p>
        <asp:GridView ID="grdUserStories" runat="server" AutoGenerateColumns="false">
            <columns>
                <asp:BoundField HeaderText="ID" DataField="Id" />
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnEdit" runat="server" CausesValidation="false" Text="Edit" OnCommand="OnButtonCommand" CommandName="Select" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnView" runat="server" CausesValidation="false" Text="View" OnCommand="OnButtonCommand" CommandName="View" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnRemove" runat="server" CausesValidation="false" Text="X" OnCommand="OnButtonCommand" CommandName="Remove" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField HeaderText="Name" DataField="Name" />
                <asp:BoundField HeaderText="Owner" DataField="Owner" />
                <asp:BoundField HeaderText="Project" DataField="Project" />
                <%-- <asp:BoundField HeaderText="Description" DataField="Description" /> --%>
                <asp:BoundField HeaderText="State" DataField="State" />
                <asp:BoundField HeaderText="Estimate" DataField="Estimate" />
                <asp:BoundField HeaderText="Actuals" DataField="Actuals" />
                <asp:BoundField HeaderText="TO DO" DataField="To_do" />
                <asp:BoundField HeaderText="Plan Estimate" DataField="Plan_Estimate" />
                <asp:BoundField HeaderText="Iteration" DataField="Iteration_id" />
                <%-- <asp:BoundField HeaderText="Notes" DataField="Notes" /> --%>
            </columns>
        </asp:GridView>
    </div>
        
    <div id="divEditMode" runat="server">
        <p>
            <asp:Label ID="lblUserStoryId" runat="server" AssociatedControlID="txtUserStoryId">ID:</asp:Label>
            <asp:TextBox ID="txtUserStoryId" runat="server" CssClass="textEntry"></asp:TextBox>
        </p>
        <p>
            <asp:Label ID="lblUserStoryName" runat="server" AssociatedControlID="txtUserStoryName">Name:</asp:Label>
            <asp:TextBox ID="txtUserStoryName" runat="server" CssClass="textEntry"></asp:TextBox>
            <asp:RequiredFieldValidator id="rfvUserStoryName" runat="server"
                                        ControlToValidate="txtUserStoryName"
                                        ErrorMessage=" * User Story name is a required field."
                                        ForeColor="Red"/>
            <br/>
            <asp:RegularExpressionValidator id="revUserStoryName" runat="server" SetFocusOnError="True"
                                            ErrorMessage="User Story Name length must be between 4 and 50 characters" Display="Dynamic"
                                            ControlToValidate="txtUserStoryName" ValidationExpression="^[\s\S]{4,50}$"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryOwnerId" runat="server" AssociatedControlID="ddlUserStoryOwnerId">Owner:</asp:Label>
            <asp:DropDownList ID="ddlUserStoryOwnerId" runat="server" />
        </p>
        <p>
            <asp:Label ID="lblUserStoryProjectId" runat="server" AssociatedControlID="ddlUserStoryProjectId">Project:</asp:Label>
            <asp:DropDownList ID="ddlUserStoryProjectId" runat="server" />
            <asp:RequiredFieldValidator id="rfvUserStoryProjectId" runat="server"
                                        ControlToValidate="ddlUserStoryProjectId"
                                        ErrorMessage=" * User Story Project is a required field."
                                        ForeColor="Red"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryDescription" runat="server" AssociatedControlID="txtUserStoryDescription">Description:</asp:Label>
            <asp:TextBox ID="txtUserStoryDescription" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RegularExpressionValidator id="revUserStoryDescription" runat="server" SetFocusOnError="True"
                                            ErrorMessage="User Story Description length must not be more than 200 characters" Display="Dynamic"
                                            ControlToValidate="txtUserStoryDescription" ValidationExpression="^[\s\S]{0,200}$"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryStateId" runat="server" AssociatedControlID="ddlUserStoryStateId">State:</asp:Label>
            <asp:DropDownList ID="ddlUserStoryStateId" runat="server" />
            <asp:RequiredFieldValidator id="rfvUserStoryStateId" runat="server"
                                        ControlToValidate="ddlUserStoryStateId"
                                        ErrorMessage=" * User Story state is a required field."
                                        ForeColor="Red"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryEstimate" runat="server" AssociatedControlID="txtUserStoryEstimate">Estimate:</asp:Label>
            <asp:TextBox ID="txtUserStoryEstimate" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RangeValidator id="revUserStoryEstimate" runat="server"
                                        ControlToValidate="txtUserStoryEstimate"
                                        MinimumValue="0"
                                        MaximumValue="2147483647"
                                        Type="Integer"
                                        Text="User Story Estimate must be integer and greater or equal than 0"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryActuals" runat="server" AssociatedControlID="txtUserStoryActuals">Actuals:</asp:Label>
            <asp:TextBox ID="txtUserStoryActuals" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RangeValidator id="revUserStoryActuals" runat="server"
                                        ControlToValidate="txtUserStoryActuals"
                                        MinimumValue="0"
                                        MaximumValue="2147483647"
                                        Type="Integer"
                                        Text="User Story Actuals must be integer and greater or equal than 0"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryToDo" runat="server" AssociatedControlID="txtUserStoryToDo">To do:</asp:Label>
            <asp:TextBox ID="txtUserStoryToDo" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RangeValidator id="revUserStoryToDo" runat="server"
                                        ControlToValidate="txtUserStoryToDo"
                                        MinimumValue="0"
                                        MaximumValue="2147483647"
                                        Type="Integer"
                                        Text="User Story To Do must be integer and greater or equal than 0"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryPlanEstimate" runat="server" AssociatedControlID="txtUserStoryPlanEstimate">Plan estimate:</asp:Label>
            <asp:TextBox ID="txtUserStoryPlanEstimate" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RangeValidator id="revUserStoryPlanEstimate" runat="server"
                                        ControlToValidate="txtUserStoryPlanEstimate"
                                        MinimumValue="0"
                                        MaximumValue="2147483647"
                                        Type="Integer"
                                        Text="User Story Plan estimate must be integer and greater or equal than 0"/>
        </p>
        <p>
            <asp:Label ID="lblUserStoryIterationId" runat="server" AssociatedControlID="ddlUserStoryIterationId">Iteration ID:</asp:Label>
            <asp:DropDownList ID="ddlUserStoryIterationId" runat="server" />
        </p>
        <p>
            <asp:Label ID="lblUserStoryNotes" runat="server" AssociatedControlID="txtUserStoryNotes">Notes:</asp:Label>
            <asp:TextBox ID="txtUserStoryNotes" runat="server" CssClass="textEntry"></asp:TextBox>
            <asp:RegularExpressionValidator id="revUserStoryNotes" runat="server" SetFocusOnError="True"
                                            ErrorMessage="User Story Notes length must not be more than 200 characters" Display="Dynamic"
                                            ControlToValidate="txtUserStoryNotes" ValidationExpression="^[\s\S]{0,200}$"/>
        </p>
        <asp:Button ID="btnCreateUpdate" runat="server" Text="Save" OnCommand="OnButtonCommand" CommandName="SaveUpdate"/>

        <asp:GridView ID="grdTasks" runat="server" AutoGenerateColumns="false" Visible="false">
            <columns>
                <asp:BoundField HeaderText="ID" DataField="Id" />
                <asp:BoundField HeaderText="Name" DataField="Name" />
                <asp:BoundField HeaderText="Owner" DataField="Owner" />
                <asp:BoundField HeaderText="Project" DataField="Project" />
                <asp:BoundField HeaderText="Description" DataField="Description" />
                <asp:BoundField HeaderText="State" DataField="State" />
                <asp:BoundField HeaderText="Estimate" DataField="Estimate" />
                <asp:BoundField HeaderText="Actuals" DataField="Actuals" />
                <asp:BoundField HeaderText="TO DO" DataField="To_do" />
                <asp:BoundField HeaderText="Notes" DataField="Notes" />
            </columns>
        </asp:GridView>
    </div>

</asp:Content>
